/**
* 全部进件路由
*/
'use strict';
import persinfoCtl from './persinfo'

module.exports = angular.module('app.perscenter', []).config(function($stateProvider) {
    $stateProvider.state('perscenter', { //共用layout
        abstract: true,
        url: '/perscenter',
        templateProvider: function($q) {
            var deferred = $q.defer();
            require.ensure(['../layout.html'], function(require) {
                var template = require('../layout.html');
                deferred.resolve(template);
            }, 'perscenter-tpl');
            return deferred.promise;
        },
        controller: 'perscenterCtrl',
        resolve: {
            'app.application': function($q, $ocLazyLoad) {
                var deferred = $q.defer();
                require.ensure(['./index.js'], function() {
                    var mod = require('./index.js');
                    $ocLazyLoad.load({
                        name: 'app.perscenter'
                    });
                    deferred.resolve(mod.controller);
                }, 'perscenter-ctl');
                return deferred.promise;
            }
        }
    }).state('perscenter.persinfo', {//个人信息
        url: '/persinfo?state?rid',
        views: {
           'content': {
               templateProvider: function($q) {
                console.log('ryy-$q', $q)
                   var deferred = $q.defer();
                   require.ensure(['./persinfo/index.html'], function(require) {
                       var template = require('./persinfo/index.html');
                       deferred.resolve(template);
                   }, 'perscenter.persinfo-tpl');
                   return deferred.promise;
               },
               controller:persinfoCtl
           }
        }
    })
    
}).name;
